<template>
	<view class="ctn">
		
		<view class="prograss-btn-wrap">
			<my-button type="text" @click='jumpPrograss'>查看进程</my-button>
		</view>
		<view class="leave-inform">
			<view class="leave-inform-tips">
				人员信息
			</view>
			<view class="inform-content">
				<my-list propTitle="姓名" :propValue="baseInfor.pk_psndoc.name" :bold="false" :boder="false"></my-list>
				<my-list propTitle="人员编码" :propValue="baseInfor.pk_psndoc.code" :bold="false" :boder="false"></my-list>
				<my-list propTitle="科室" :propValue="baseInfor.pk_dept.name" :bold="false" :boder="false"></my-list>
			</view>
		</view>
		<view class="leave-inform">
			<view class="leave-inform-tips">
				请假信息
			</view>
			<view class="inform-content">
				<my-list propTitle="请假类别" :propValue="leaveType" :bold="false" :boder="false"></my-list>
				<my-list propTitle="请假时长" :propValue="baseInfor.sumhour+'天'" :bold="false" :boder="false"
					:boldValue="true"></my-list>
				<my-list propTitle="请假原因" propValue="" :bold="false" :boder="false"></my-list>
				<view class="leave-reason">{{Leavereason}}</view>

			</view>
		</view>
		<view class="leave-inform">
			<view class="leave-inform-tips">
				请假日期
			</view>
			<view class="inform-content">
				<view class="time-sub" v-for="(item,index) in leaveinfor" :key='index'>
					<my-list propTitle="开始时间" :propValue="item.leavebegintime" :bold="false" :boder="false"></my-list>
					<my-list propTitle="结束时间" :propValue="item.leaveendtime" :bold="false" :boder="false"></my-list>
				</view>
			</view>
		</view>
		<view class="leave-inform">
			<view class="leave-inform-tips">
				附件
			</view>
			<view class="upFiles">
				<view class="filie-list">
					<view v-for="(item, index) in fileValue" :key="index" class="file-sub">
						<view @click="clickDowload(item)">{{ item.name }}</view>
						<view @click="clickDowload(item)" class="delete">下载</view>
					</view>
				</view>
				<!-- <uni-file-picker v-model="fileValue" fileMediatype="xls" ref="files" mode="grid" :auto-upload="false"
					@select="select" @progress="progress" @delete='delFile' @hanclick='clickDowload'>
					<view class="upload">
						<my-button type="text"><span class="iconfont icon-yunshangchuan">上传文件</span></my-button>
					</view>
				</uni-file-picker> -->
			</view>
		</view>
		<view id='dowload'></view>
		<view class="leave-inform">
			<!-- <view class="leave-inform-tips">
				附件信息
			</view>
			<view class="inform-content">
				<my-list propTitle="姓名" :propValue="baseInfor.pk_psndoc.name" :bold="false" :boder="false"></my-list>
				<my-list propTitle="人员编码" :propValue="baseInfor.pk_psndoc.code" :bold="false" :boder="false"></my-list>
			</view> -->
		</view>
	</view>
</template>

<script>
	import service from '../../../common/service/new_file.js'
	import apiData from '../../../common/utils/apiData.js'
	export default {
		data() {
			return {
				appStatus: 1,
				iconList: [],
				baseInfor: {},
				leaveType: '',
				Leavereason: '',
				leaveinfor: {},
				fileValue: [],
				nowTem: null,
				url:''
			}
		},
		methods: {
			jumpPrograss(){
				let pk = this.baseInfor.pk_leave_h
				uni.navigateTo({
					url:'../../attendance/attendacePrograss?pk='+pk+'&billtype=HA01'
				})
			},
			clickDowload(item) {
				var query = window.location.origin
				let url = query+'/api'+item.url
				window.open(url)
				// let iframe = document.createElement('iframe')
				// iframe.src = url
				// iframe.style.display='none'
				// var dowload = document.getElementById("dowload")
				// dowload.appendChild(iframe);
			},
			getFileList(pk) {
				let _this = this
				let data = apiData.getFileList(pk);
				service.common(data, {
					success: function(res) {
						let fileData = []
						res.data.VALUES.forEach(item => {
							fileData.push({
								name: item.filename,
								extname: "xls",
								url: item.filepath,
								pk: item.pk
							})
						})
						_this.fileValue = fileData
					},
					fail: function(res) {}
				});
			},
		},
		onLoad(options) {
			let leaveItem = JSON.parse(options.item)
			this.baseInfor = leaveItem.hvo
			this.leaveinfor = leaveItem.bvos
			this.Leavereason = leaveItem.bvos[0].leaveremark ? leaveItem.bvos[0].leaveremark : '未填写'
			let strSlp = leaveItem.msg.split('休假类别')[1].split(':')[1]
			this.leaveType = strSlp
			this.getFileList(leaveItem.hvo.pk_leave_h)
		}
	}
</script>

<style lang="scss">
	.prograss-btn-wrap{
		display: flex;
		flex-direction: row-reverse;
	}
	.filie-list {
		padding: 0 36rpx;
	}
	.file-sub {
		display: flex;
		justify-content: space-between;
		align-items: center;
		color: #434343;
		padding: 8rpx 10rpx;
		border-bottom: 1rpx solid #dcdcdc;
		margin-bottom: 5rpx;
	}
	.delete{
		color: #007AFF;
		font-size: 30rpx;
	}
	.ctn {
		padding: 20rpx 36rpx;

		.leave-inform {
			margin-top: 20rpx;
			.leave-inform-tips {
				font-weight: 600;
				font-size: 30rpx;
				color: #007AFF;
				padding-left: 10rpx;
			}
		}
	}

	.leave-reason {
		margin-left: 40rpx;
		margin-bottom: 10rpx;
		padding: 20rpx 10rpx;
		border: 2rpx solid #dcdcdc;
		border-radius: 8rpx;
		font-size: 26rpx;
		color: #626262;
	}

	.time-sub {
		border-bottom: 2rpx solid #dddddd;
	}
</style>
